{
Author:  Prof1983 prof1983@yandex.ru
Created: 05.11.2008
LastMod: 19.03.2009
}
unit AUIclPageControl;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
  Classes, ComCtrls, Controls, Forms, Graphics, StdCtrls,
  ABase, AUI, AUIcl, AUIclFont, AUIclPopupMenu;

type
  TAUIPageControl = class(TInterfacedObject, IAUIclPageControl)
  private
    FControl: TPageControl;
    FFont: IAUIFont;
    FPopupMenu: IAUIPopupMenu;
    FRequestSize: TAUISize;
    FUI: IAUserInterface;
  protected // IAUIControl
    function GetEnabled: ABoolean;
    function GetHint: AString;
    function GetName: AString;
    function GetText: AString;
    function GetVisible: ABoolean;
    procedure SetEnabled(Value: ABoolean);
    procedure SetHint(const Value: AString);
    procedure SetName(const Value: AString);
    procedure SetText(const Value: AString);
    procedure SetVisible(Value: ABoolean);
  protected // IAUIclPageControl
    function Get_Align: Integer;
    function Get_BiDiMode: Integer;
    function Get_Cursor: Integer;
    function Get_DockSite: ABoolean;
    function Get_DragCursor: Integer;
    function Get_DragKind: Integer;
    function Get_DragMode: Integer;
    function Get_Font: IAUIFont;
    function Get_Height: Integer;
    function Get_HelpContext: Integer;
    function Get_HelpKeyword: AString;
    function Get_HelpType: Integer;
    function Get_HotTrack: ABoolean;
    function Get_Left: Integer;
    function Get_MultiLine: ABoolean;
    function Get_OwnerDraw: ABoolean;
    //function Get_ParentBiDiMode: Integer;
    //function Get_ParentFont: Integer;
    function Get_PopupMenu: IAUIPopupMenu;
    function Get_RaggedRight: ABoolean;
    function Get_ScrollOpposite: ABoolean;
    //function Get_ShowHint: Integer;
    function Get_Style: Integer;
    function Get_TabHeight: Integer;
    function Get_TabIndex: Integer;
    function Get_TabOrder: Integer;
    function Get_TabPosition: Integer;
    function Get_TabStop: ABoolean;
    function Get_TabWidth: Integer;
    function Get_Tag: Integer;
    function Get_Top: Integer;
    function Get_Width: Integer;
    procedure Set_Align(Value: Integer);
    procedure Set_BiDiMode(Value: Integer);
    procedure Set_Cursor(Value: Integer);
    procedure Set_DockSite(Value: ABoolean);
    procedure Set_DragCursor(Value: Integer);
    procedure Set_DragKind(Value: Integer);
    procedure Set_DragMode(Value: Integer);
    procedure Set_Height(Value: Integer);
    procedure Set_HelpContext(Value: Integer);
    procedure Set_HelpKeyword(const Value: AString);
    procedure Set_HelpType(Value: Integer);
    procedure Set_HotTrack(Value: ABoolean);
    procedure Set_Left(Value: Integer);
    procedure Set_MultiLine(Value: ABoolean);
    procedure Set_OwnerDraw(Value: ABoolean);
    //procedure Set_ParentBiDiMode(Value: Integer);
    //procedure Set_ParentFont(Value: Integer);
    procedure Set_RaggedRight(Value: ABoolean);
    procedure Set_ScrollOpposite(Value: ABoolean);
    //procedure Set_ShowHint(Value: Integer);
    procedure Set_Style(Value: Integer);
    procedure Set_TabHeight(Value: Integer);
    procedure Set_TabIndex(Value: Integer);
    procedure Set_TabOrder(Value: Integer);
    procedure Set_TabPosition(Value: Integer);
    procedure Set_TabStop(Value: ABoolean);
    procedure Set_TabWidth(Value: Integer);
    procedure Set_Tag(Value: Integer);
    procedure Set_Top(Value: Integer);
    procedure Set_Width(Value: Integer);
    {function Get_ParentShowHint: Integer;
    procedure Set_ParentShowHint(Value: Integer);}
  public
    function GetRequestSize: TAUISize;
    function GetWidgetID: AInteger;
    procedure AddWidget(Widget: IAUIWidget);
    procedure SetAllocateSize(Width, Height: Integer);
    procedure SetPosition(ALeft, ATop: Integer);
    procedure SetRequestSize(Width, Height: Integer);
  public
    constructor Create(UI: IAUserInterface; Control: TPageControl);
    class function New(UI: IAUserInterface): IAUIclPageControl;
  end;

implementation

{ TAUIPageControl }

procedure TAUIPageControl.AddWidget(Widget: IAUIWidget);
begin
end;

constructor TAUIPageControl.Create(UI: IAUserInterface; Control: TPageControl);
begin
  FUI := UI;
  FControl := Control;
end;

function TAUIPageControl.Get_Left: Integer;
begin
  Result := FControl.Left;
end;

function TAUIPageControl.GetName: AString;
begin
  Result := FControl.Name;
end;

function TAUIPageControl.Get_Tag: Integer;
begin
  Result := FControl.Tag;
end;

class function TAUIPageControl.New(UI: IAUserInterface): IAUIclPageControl;
begin
  Result := TAUIPageControl.Create(UI, TPageControl.Create(nil));
end;

procedure TAUIPageControl.Set_Left(Value: Integer);
begin
  FControl.Left := Value;
end;

procedure TAUIPageControl.SetName(const Value: AString);
begin
  FControl.Name := Value;
end;

procedure TAUIPageControl.Set_Tag(Value: Integer);
begin
  FControl.Tag := Value;
end;


function TAUIPageControl.Get_Top: Integer;
begin
  Result := FControl.Top;
end;

procedure TAUIPageControl.Set_Top(Value: Integer);
begin
  FControl.Top := Value;
end;

function TAUIPageControl.Get_Width: Integer;
begin
  Result := FControl.Width;
end;

procedure TAUIPageControl.Set_Width(Value: Integer);
begin
  FControl.Width := Value;
end;

function TAUIPageControl.Get_Height: Integer;
begin
  Result := FControl.Height;
end;

procedure TAUIPageControl.Set_Height(Value: Integer);
begin
  FControl.Height := Value;
end;

function TAUIPageControl.Get_Cursor: Integer;
begin
  Result := FControl.Cursor;
end;

procedure TAUIPageControl.Set_Cursor(Value: Integer);
begin
  FControl.Cursor := Value;
end;

function TAUIPageControl.GetHint: AString;
begin
  Result := FControl.Hint;
end;

procedure TAUIPageControl.SetHint(const Value: AString);
begin
  FControl.Hint := Value;
end;

function TAUIPageControl.Get_HelpType: Integer;
begin
  Result := Integer(FControl.HelpType);
end;

procedure TAUIPageControl.Set_HelpType(Value: Integer);
begin
  FControl.HelpType := THelpType(Value);
end;

function TAUIPageControl.Get_HelpKeyword: AString;
begin
  Result := FControl.HelpKeyword;
end;

procedure TAUIPageControl.Set_HelpKeyword(const Value: AString);
begin
  FControl.HelpKeyword := Value;
end;

function TAUIPageControl.Get_HelpContext: Integer;
begin
  Result := FControl.HelpContext;
end;

procedure TAUIPageControl.Set_HelpContext(Value: Integer);
begin
  FControl.HelpContext := Value;
end;

function TAUIPageControl.Get_Align: Integer;
begin
  Result := Integer(FControl.Align);
end;

procedure TAUIPageControl.Set_Align(Value: Integer);
begin
  FControl.Align := TAlign(Value);
end;

function TAUIPageControl.Get_BiDiMode: Integer;
begin
  Result := Integer(FControl.BiDiMode);
end;

procedure TAUIPageControl.Set_BiDiMode(Value: Integer);
begin
  FControl.BiDiMode := TBiDiMode(Value);
end;

function TAUIPageControl.Get_DockSite: ABoolean;
begin
  Result := FControl.DockSite;
end;

procedure TAUIPageControl.Set_DockSite(Value: ABoolean);
begin
  FControl.DockSite := Value;
end;

function TAUIPageControl.Get_DragCursor: Integer;
begin
  Result := FControl.DragCursor;
end;

procedure TAUIPageControl.Set_DragCursor(Value: Integer);
begin
  FControl.DragCursor := Value;
end;

function TAUIPageControl.Get_DragKind: Integer;
begin
  Result := Integer(FControl.DragKind);
end;

procedure TAUIPageControl.Set_DragKind(Value: Integer);
begin
  FControl.DragKind := TDragKind(Value);
end;

function TAUIPageControl.Get_DragMode: Integer;
begin
  Result := Integer(FControl.DragMode);
end;

procedure TAUIPageControl.Set_DragMode(Value: Integer);
begin
  FControl.DragMode := TDragMode(Value);
end;

function TAUIPageControl.GetEnabled: ABoolean;
begin
  Result := FControl.Enabled;
end;

procedure TAUIPageControl.SetEnabled(Value: ABoolean);
begin
  FControl.Enabled := Value;
end;

function TAUIPageControl.Get_Font: IAUIFont;
begin
  if not(Assigned(FFont)) then
    if Assigned(FControl.Font) then
      FFont := TAUIFont.Create(FControl.Font);
  Result := FFont;
  //Result := TExControlFont.Create(TFont(FControl.Font));
end;

function TAUIPageControl.Get_HotTrack: ABoolean;
begin
  {$IFNDEF FPC}
  Result := FControl.HotTrack;
  {$ELSE}
  Result := False;
  {$ENDIF}
end;

procedure TAUIPageControl.Set_HotTrack(Value: ABoolean);
begin
  {$IFNDEF FPC}
  FControl.HotTrack := Value;
  {$ENDIF}
end;

function TAUIPageControl.Get_MultiLine: ABoolean;
begin
  {$IFNDEF FPC}
  Result := FControl.MultiLine;
  {$ELSE}
  Result := False;
  {$ENDIF}
end;

procedure TAUIPageControl.Set_MultiLine(Value: ABoolean);
begin
  {$IFNDEF FPC}
  FControl.MultiLine := Value;
  {$ENDIF}
end;

function TAUIPageControl.Get_OwnerDraw: ABoolean;
begin
  {$IFNDEF FPC}
  Result := FControl.OwnerDraw;
  {$ELSE}
  Result := False;
  {$ENDIF}
end;

procedure TAUIPageControl.Set_OwnerDraw(Value: ABoolean);
begin
  {$IFNDEF FPC}
  FControl.OwnerDraw := Value;
  {$ENDIF}
end;

{function TAUIPageControl.Get_ParentBiDiMode: Integer;
begin
  if (FControl.ParentBiDiMode = False) then Result := 0;
  if (FControl.ParentBiDiMode = True) then Result := 1;
end;

procedure TAUIPageControl.Set_ParentBiDiMode(Value: Integer);
begin
  if (Value = 0) then FControl.ParentBiDiMode := False;
  if (Value = 1) then FControl.ParentBiDiMode := True;
end;

function TAUIPageControl.Get_ParentFont: Integer;
begin
  if (FControl.ParentFont = False) then Result := 0;
  if (FControl.ParentFont = True) then Result := 1;
end;

procedure TAUIPageControl.Set_ParentFont(Value: Integer);
begin
  if (Value = 0) then FControl.ParentFont := False;
  if (Value = 1) then FControl.ParentFont := True;
end;

function TAUIPageControl.Get_ParentShowHint: Integer;
begin
  if (FControl.ParentShowHint = False) then Result := 0;
  if (FControl.ParentShowHint = True) then Result := 1;
end;

procedure TAUIPageControl.Set_ParentShowHint(Value: Integer);
begin
  if (Value = 0) then FControl.ParentShowHint := False;
  if (Value = 1) then FControl.ParentShowHint := True;
end;}

function TAUIPageControl.Get_PopupMenu: IAUIPopupMenu;
begin
  if not(Assigned(FPopupMenu)) then
    if Assigned(FControl.PopupMenu) then
      FPopupMenu := TAUIPopupMenu.Create(FUI, FControl.PopupMenu);
  Result := FPopupMenu;
  //Result := TExControlPopupMenu.Create(TTntPopupMenu(FControl.PopupMenu));
end;

function TAUIPageControl.Get_RaggedRight: ABoolean;
begin
  {$IFNDEF FPC}
  Result := FControl.RaggedRight;
  {$ELSE}
  Result := False;
  {$ENDIF}
end;

procedure TAUIPageControl.Set_RaggedRight(Value: ABoolean);
begin
  {$IFNDEF FPC}
  FControl.RaggedRight := Value;
  {$ENDIF}
end;

function TAUIPageControl.Get_ScrollOpposite: ABoolean;
begin
  {$IFNDEF FPC}
  Result := FControl.ScrollOpposite;
  {$ELSE}
  Result := False;
  {$ENDIF}
end;

procedure TAUIPageControl.Set_ScrollOpposite(Value: ABoolean);
begin
  {$IFNDEF FPC}
  FControl.ScrollOpposite := Value;
  {$ENDIF}
end;

{function TAUIPageControl.Get_ShowHint: Integer;
begin
  if (FControl.ShowHint = False) then Result := 0;
  if (FControl.ShowHint = True) then Result := 1;
end;

procedure TAUIPageControl.Set_ShowHint(Value: Integer);
begin
  if (Value = 0) then FControl.ShowHint := False;
  if (Value = 1) then FControl.ShowHint := True;
end;}

function TAUIPageControl.Get_Style: Integer;
begin
  {$IFNDEF FPC}
  Result := Integer(FControl.Style);
  {$ELSE}
  Result := 0;
  {$ENDIF}
end;

procedure TAUIPageControl.Set_Style(Value: Integer);
begin
  {$IFNDEF FPC}
  FControl.Style := TTabStyle(Value);
  {$ENDIF}
end;

function TAUIPageControl.Get_TabHeight: Integer;
begin
  {$IFNDEF FPC}
  Result := FControl.TabHeight;
  {$ENDIF}
end;

procedure TAUIPageControl.Set_TabHeight(Value: Integer);
begin
  {$IFNDEF FPC}
  FControl.TabHeight := Value;
  {$ENDIF}
end;

function TAUIPageControl.Get_TabIndex: Integer;
begin
  Result := FControl.TabIndex;
end;

procedure TAUIPageControl.Set_TabIndex(Value: Integer);
begin
  FControl.TabIndex := Value;
end;

function TAUIPageControl.Get_TabOrder: Integer;
begin
  Result := FControl.TabOrder;
end;

procedure TAUIPageControl.Set_TabOrder(Value: Integer);
begin
  FControl.TabOrder := Value;
end;

function TAUIPageControl.Get_TabPosition: Integer;
begin
  {$IFNDEF FPC}
  Result := Integer(FControl.TabPosition);
  {$ELSE}
  Result := 0;
  {$ENDIF}
end;

procedure TAUIPageControl.Set_TabPosition(Value: Integer);
begin
  {$IFNDEF FPC}
  FControl.TabPosition := TTabPosition(Value);
  {$ENDIF}
end;

function TAUIPageControl.Get_TabStop: ABoolean;
begin
  Result := FControl.TabStop;
end;

procedure TAUIPageControl.Set_TabStop(Value: ABoolean);
begin
  FControl.TabStop := Value;
end;

function TAUIPageControl.Get_TabWidth: Integer;
begin
  {$IFNDEF FPC}
  Result := FControl.TabWidth;
  {$ELSE}
  Result := 0;
  {$ENDIF}
end;

procedure TAUIPageControl.Set_TabWidth(Value: Integer);
begin
  {$IFNDEF FPC}
  FControl.TabWidth := Value;
  {$ENDIF}
end;

function TAUIPageControl.GetVisible: ABoolean;
begin
  Result := FControl.Visible;
end;

procedure TAUIPageControl.SetVisible(Value: ABoolean);
begin
  FControl.Visible := Value;
end;

function TAUIPageControl.GetText: AString;
begin
  Result := '';
end;

procedure TAUIPageControl.SetText(const Value: AString);
begin
end;

function TAUIPageControl.GetWidgetID: AInteger;
begin
  Result := 0;
end;

function TAUIPageControl.GetRequestSize: TAUISize;
begin
  Result := FRequestSize;
end;

procedure TAUIPageControl.SetAllocateSize(Width, Height: Integer);
begin
  FControl.Width := Width;
  FControl.Height := Height;
end;

procedure TAUIPageControl.SetPosition(ALeft, ATop: Integer);
begin
  FControl.Left := ALeft;
  FControl.Top := ATop;
end;

procedure TAUIPageControl.SetRequestSize(Width, Height: Integer);
begin
  FRequestSize.Width := Width;
  FRequestSize.Height := Height;
end;

end.
